<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="baidu-site-verification" content="L6Lm9d5Crl"/>
  
  
  
  
  <title>MyBatis多对一和一对多 | 烟花小神</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="date: 2019/8/15 21:23:48  MyBatis的强大特性之一。">
<meta property="og:type" content="article">
<meta property="og:title" content="MyBatis多对一和一对多">
<meta property="og:url" content="http://www.lan666.top/2019/08/15/MyBatis多对一和一对多/index.html">
<meta property="og:site_name" content="烟花小神">
<meta property="og:description" content="date: 2019/8/15 21:23:48  MyBatis的强大特性之一。">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2019-08-15T14:21:28.376Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="MyBatis多对一和一对多">
<meta name="twitter:description" content="date: 2019/8/15 21:23:48  MyBatis的强大特性之一。">
  
    <link rel="alternative" href="/atom.xml" title="烟花小神" type="application/atom+xml">
  
  
    <link rel="icon" href="/img/avatar.png">
  
  
  <link rel="stylesheet" href="//cdn.bootcss.com/animate.css/3.5.0/animate.min.css">
  
  <link rel="stylesheet" href="/css/style.css">
  <link rel="stylesheet" href="/font-awesome/css/font-awesome.min.css">
  <link rel="apple-touch-icon" href="/apple-touch-icon.png">
  
  
      <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  
  <!-- 加载特效 -->
    <script src="/js/pace.js"></script>
    <link href="/css/pace/pace-theme-flash.css" rel="stylesheet" />
  <script>
      var yiliaConfig = {
          fancybox: true,
          animate: true,
          isHome: false,
          isPost: true,
          isArchive: false,
          isTag: false,
          isCategory: false,
          open_in_new: false
      }
  </script>
</head>
<body>
  <div id="container">
    <div class="left-col">
    <div class="overlay"></div>
<div class="intrude-less">
    <header id="header" class="inner">
        
<script src="https://7.url.cn/edu/jslib/comb/require-2.1.6,jquery-1.9.1.min.js"></script>

        <a href="/" class="profilepic">
            
            <img lazy-src="/img/avatar.png" class="js-avatar">
            
        </a>
        <hgroup>
          <h1 class="header-author"><a href="/">烟花小神博客</a></h1>
        </hgroup>
        
        
        
        
        <div id="switch-area" class="switch-area">
            <div class="switch-wrap">
                <section class="switch-part switch-part1">
                    <nav class="header-menu">
                        <ul>
                        
                            <li><a  href="http://lan666.top">主页</a></li>
                        
                            <li><a  href="/archives/">文章</a></li>
                        
                            <li><a  href="http://wpa.qq.com/msgrd?v=3&uin=1347229508&site=qq&menu=yes">QQ</a></li>
                        
                            <li><a  href="mailto:1347229508@qq.com">邮箱</a></li>
                        
                            <li><a  href="http://weibo.com/1721934155">微博</a></li>
                        
                        </ul>
                    </nav>
                    <nav class="header-nav">
                        <ul class="social">
                            
                        </ul>
                    </nav>
                </section>
                
                
                
            </div>
        </div>
    </header>
</div>

    </div>
    <div class="mid-col">
      <nav id="mobile-nav">
      <div class="overlay">
          <div class="slider-trigger"></div>
          <h1 class="header-author js-mobile-header hide"><a href="/" title="回到主页">烟花小神博客</a></h1>
      </div>
    <div class="intrude-less">
        <header id="header" class="inner">
            <a href="/" class="profilepic">
                
                    <img lazy-src="/img/avatar.png" class="js-avatar">
                
            </a>
            <hgroup>
              <h1 class="header-author"><a href="/" title="回到主页">烟花小神博客</a></h1>
            </hgroup>
            
            <nav class="header-menu">
                <ul>
                
                    <li><a href="http://lan666.top">主页</a></li>
                
                    <li><a href="/archives/">文章</a></li>
                
                    <li><a href="http://wpa.qq.com/msgrd?v=3&uin=1347229508&site=qq&menu=yes">QQ</a></li>
                
                    <li><a href="mailto:1347229508@qq.com">邮箱</a></li>
                
                    <li><a href="http://weibo.com/1721934155">微博</a></li>
                
                <div class="clearfix"></div>
                </ul>
            </nav>
            <nav class="header-nav">
                <div class="social">
                    
                </div>
            </nav>
        </header>
    </div>
</nav>
      <div class="body-wrap"><article id="post-MyBatis多对一和一对多" class="article article-type-post" itemscope itemprop="blogPost">
  
    <div class="article-meta">
      <a  href="/2019/08/15/MyBatis多对一和一对多/" class="article-date">
      <time datetime="2019-08-15T14:07:46.957Z" itemprop="datePublished">2019-08-15</time>
</a>

    </div>
  
  <div class="article-inner">
    
      <input type="hidden" class="isFancy" />
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      MyBatis多对一和一对多
    </h1>
  


      </header>
      
      <div class="article-info article-info-post">
        

        
        <div class="clearfix"></div>
      </div>
      
    
    <div class="article-entry" itemprop="articleBody">
      
          
        <h2 id="date-2019-8-15-21-23-48"><a href="#date-2019-8-15-21-23-48" class="headerlink" title="date: 2019/8/15 21:23:48  "></a>date: 2019/8/15 21:23:48  </h2><p><excerpt in="" index="" |="" 首页摘要=""><br>MyBatis的强大特性之一。<a id="more"></a></excerpt></p>
<p><the rest="" of="" contents="" |="" 余下全文=""><br><!--代码高亮--></the></p>
<hr>
<h1 id="1-collection-标签"><a href="#1-collection-标签" class="headerlink" title="1.collection 标签"></a>1.collection 标签</h1><blockquote>
<p>   第一种 一对多查询<br>   先配置一个 resultMap</p>
</blockquote>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line"></div><div class="line"><span class="tag">&lt;<span class="name">resultMap</span> <span class="attr">id</span>=<span class="string">"model2"</span> <span class="attr">type</span>=<span class="string">"tdept"</span>&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">id</span> <span class="attr">column</span>=<span class="string">"deptid"</span> <span class="attr">property</span>=<span class="string">"deptid"</span>/&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">result</span> <span class="attr">column</span>=<span class="string">"dname"</span> <span class="attr">property</span>=<span class="string">"dname"</span>/&gt;</span></div><div class="line">	<span class="comment">&lt;!--多对一的标签  --&gt;</span></div><div class="line">	<span class="comment">&lt;!-- tEmps 为 tdept中的  list集合名称 --&gt;</span></div><div class="line">	<span class="comment">&lt;!--column 就是 resultMap中的id的column--&gt;</span></div><div class="line">	<span class="comment">&lt;!--select 就是 从表中的外键 对于 deptid 进行查询  --&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">collection</span> <span class="attr">property</span>=<span class="string">"tEmps"</span> <span class="attr">column</span>=<span class="string">"deptid"</span> <span class="attr">select</span>=<span class="string">"com.xiaolan.mapper.TEmpMapper.selectAllByDId"</span>/&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">resultMap</span>&gt;</span></div></pre></td></tr></table></figure>
<hr>
<blockquote>
<p>看看 两张表的 查询语句 以及返回 类型</p>
</blockquote>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line"></div><div class="line"><span class="comment">&lt;!-- 主表的返回类型是  resultMap="model2"  --&gt;</span></div><div class="line"><span class="comment">&lt;!-- 查询的是 主键id --&gt;</span></div><div class="line"><span class="tag">&lt;<span class="name">select</span> <span class="attr">id</span>=<span class="string">"selectById"</span> <span class="attr">resultMap</span>=<span class="string">"model2"</span> <span class="attr">parameterType</span>=<span class="string">"int"</span>&gt;</span></div><div class="line">    select * from t_dept where deptid = #&#123;deptid&#125;;</div><div class="line"><span class="tag">&lt;/<span class="name">select</span>&gt;</span></div></pre></td></tr></table></figure>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line"></div><div class="line"><span class="comment">&lt;!-- 从表的返回类型是  resultType="temp"  --&gt;</span></div><div class="line"><span class="comment">&lt;!-- 查询的是 depid 外键--&gt;</span></div><div class="line"><span class="tag">&lt;<span class="name">select</span> <span class="attr">id</span>=<span class="string">"selectAllByDId"</span> <span class="attr">resultType</span>=<span class="string">"temp"</span> <span class="attr">parameterType</span>=<span class="string">"int"</span>&gt;</span></div><div class="line">    select * from t_emp where depid = #&#123;depid&#125;</div><div class="line"><span class="tag">&lt;/<span class="name">select</span>&gt;</span></div></pre></td></tr></table></figure>
<hr>
<blockquote>
<p>第二种 一对多查询<br>新配置一个 resultMap            </p>
</blockquote>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line"></div><div class="line"><span class="tag">&lt;<span class="name">resultMap</span> <span class="attr">id</span>=<span class="string">""</span> <span class="attr">type</span>=<span class="string">"tdept"</span>&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">id</span> <span class="attr">column</span>=<span class="string">"deptid"</span> <span class="attr">property</span>=<span class="string">"deptid"</span>/&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">result</span> <span class="attr">column</span>=<span class="string">"dname"</span> <span class="attr">property</span>=<span class="string">"dname"</span>/&gt;</span></div><div class="line">	<span class="comment">&lt;!-- property 实体类list 名字 --&gt;</span></div><div class="line">	<span class="comment">&lt;!-- ofType 里面写从表的 实体类 --&gt;</span></div><div class="line">	<span class="comment">&lt;!-- 里面是映射字段 --&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">collection</span> <span class="attr">property</span>=<span class="string">"tEmps"</span> <span class="attr">ofType</span>=<span class="string">"temp"</span>&gt;</span></div><div class="line">        <span class="tag">&lt;<span class="name">id</span> <span class="attr">column</span>=<span class="string">"empid"</span> <span class="attr">property</span>=<span class="string">"empid"</span>/&gt;</span></div><div class="line">        <span class="tag">&lt;<span class="name">result</span> <span class="attr">column</span>=<span class="string">"ename"</span> <span class="attr">property</span>=<span class="string">"ename"</span>/&gt;</span></div><div class="line">        <span class="tag">&lt;<span class="name">result</span> <span class="attr">column</span>=<span class="string">"egendar"</span> <span class="attr">property</span>=<span class="string">"egendar"</span>/&gt;</span></div><div class="line">    <span class="tag">&lt;/<span class="name">collection</span>&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">resultMap</span>&gt;</span></div></pre></td></tr></table></figure>
<blockquote>
<p>直接分析下 xml</p>
</blockquote>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line"></div><div class="line"><span class="comment">&lt;!-- 两张表连接查询 resultMap="model"  --&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">select</span> <span class="attr">id</span>=<span class="string">"selectAll"</span> <span class="attr">resultMap</span>=<span class="string">"model"</span>&gt;</span></div><div class="line">        select</div><div class="line">        *</div><div class="line">        from</div><div class="line">        t_dept d ,</div><div class="line">        t_emp e</div><div class="line">        where d.deptid = 1 and d.deptid = e.depid</div><div class="line">    <span class="tag">&lt;/<span class="name">select</span>&gt;</span></div></pre></td></tr></table></figure>
<h1 id="2-association-标签"><a href="#2-association-标签" class="headerlink" title="2.association 标签"></a>2.association 标签</h1><blockquote>
<p>第一种 多对一查询<br>先配置一个 resultMap</p>
</blockquote>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">resultMap</span> <span class="attr">id</span>=<span class="string">"model"</span> <span class="attr">type</span>=<span class="string">"temp"</span>&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">id</span> <span class="attr">column</span>=<span class="string">"empid"</span> <span class="attr">property</span>=<span class="string">"empid"</span>/&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">result</span> <span class="attr">column</span>=<span class="string">"ename"</span> <span class="attr">property</span>=<span class="string">"ename"</span>/&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">result</span> <span class="attr">column</span>=<span class="string">"egendar"</span> <span class="attr">property</span>=<span class="string">"egendar"</span>/&gt;</span></div><div class="line"> 	<span class="comment">&lt;!-- property 实体类中的对象--&gt;</span></div><div class="line">  	<span class="comment">&lt;!-- javaType 对象类型 --&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">association</span> <span class="attr">property</span>=<span class="string">"dept"</span> <span class="attr">javaType</span>=<span class="string">"tdept"</span>&gt;</span></div><div class="line">        <span class="tag">&lt;<span class="name">id</span> <span class="attr">column</span>=<span class="string">"deptid"</span> <span class="attr">property</span>=<span class="string">"deptid"</span>/&gt;</span></div><div class="line">        <span class="tag">&lt;<span class="name">result</span> <span class="attr">column</span>=<span class="string">"dname"</span> <span class="attr">property</span>=<span class="string">"dname"</span>/&gt;</span></div><div class="line">    <span class="tag">&lt;/<span class="name">association</span>&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">resultMap</span>&gt;</span></div></pre></td></tr></table></figure>
<blockquote>
<p>看看 两张表的连接 查询语句 以及返回 类型</p>
</blockquote>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line"></div><div class="line"><span class="tag">&lt;<span class="name">select</span> <span class="attr">id</span>=<span class="string">"findByAlls"</span> <span class="attr">resultMap</span>=<span class="string">"model"</span>&gt;</span></div><div class="line">    select * from t_dept d, t_emp e where d.deptid = e.depid and e.empid  = 1</div><div class="line"><span class="tag">&lt;/<span class="name">select</span>&gt;</span></div></pre></td></tr></table></figure>
<hr>
<blockquote>
<p>第二种 多对一查询<br>先配置一个 resultMap</p>
</blockquote>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">resultMap</span> <span class="attr">id</span>=<span class="string">"model22"</span> <span class="attr">type</span>=<span class="string">"temp"</span>&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">id</span> <span class="attr">column</span>=<span class="string">"empid"</span> <span class="attr">property</span>=<span class="string">"empid"</span>/&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">result</span> <span class="attr">column</span>=<span class="string">"ename"</span> <span class="attr">property</span>=<span class="string">"ename"</span>/&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">result</span> <span class="attr">column</span>=<span class="string">"egendar"</span> <span class="attr">property</span>=<span class="string">"egendar"</span>/&gt;</span></div><div class="line">	 <span class="comment">&lt;!-- property 实体类名称 --&gt;</span></div><div class="line"> 	<span class="comment">&lt;!-- column 数据库外键字段 --&gt;</span></div><div class="line">	<span class="comment">&lt;!-- select 主键的查询id --&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">association</span> <span class="attr">property</span>=<span class="string">"dept"</span> <span class="attr">column</span>=<span class="string">"depid"</span> <span class="attr">select</span>=<span class="string">"com.xiaolan.mapper.TDeptMapper.selectByIds"</span>&gt;</span></div><div class="line">    <span class="tag">&lt;/<span class="name">association</span>&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">resultMap</span>&gt;</span></div></pre></td></tr></table></figure>
<hr>
<blockquote>
<p>看看 两张表的 查询语句 以及返回 类型</p>
</blockquote>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line"></div><div class="line"><span class="comment">&lt;!-- 主表的返回类型是  resultMap="model2"  --&gt;</span></div><div class="line"><span class="comment">&lt;!-- 查询的是 主键id --&gt;</span></div><div class="line"></div><div class="line"> <span class="comment">&lt;!-- 这里采用 了foreach 实现 多对一的效果 --&gt;</span></div><div class="line"><span class="tag">&lt;<span class="name">select</span> <span class="attr">id</span>=<span class="string">"selectAllById"</span> <span class="attr">resultMap</span>=<span class="string">"model22"</span> <span class="attr">parameterType</span>=<span class="string">"list"</span>&gt;</span></div><div class="line">    select * from t_emp</div><div class="line">    <span class="tag">&lt;<span class="name">where</span>&gt;</span></div><div class="line">        <span class="tag">&lt;<span class="name">foreach</span> <span class="attr">collection</span>=<span class="string">"list"</span> <span class="attr">separator</span>=<span class="string">","</span> <span class="attr">close</span>=<span class="string">")"</span> <span class="attr">open</span>=<span class="string">"empid in ("</span> <span class="attr">item</span>=<span class="string">"ids"</span>&gt;</span></div><div class="line">            #&#123;ids&#125;</div><div class="line">        <span class="tag">&lt;/<span class="name">foreach</span>&gt;</span></div><div class="line">    <span class="tag">&lt;/<span class="name">where</span>&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">select</span>&gt;</span></div></pre></td></tr></table></figure>
<hr>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line"></div><div class="line"><span class="comment">&lt;!-- 主表的返回类型是  resultType="tdept"  --&gt;</span></div><div class="line"><span class="comment">&lt;!-- 查询的是 主键id--&gt;</span></div><div class="line"><span class="tag">&lt;<span class="name">select</span> <span class="attr">id</span>=<span class="string">"selectByIds"</span> <span class="attr">resultType</span>=<span class="string">"tdept"</span> <span class="attr">parameterType</span>=<span class="string">"int"</span>&gt;</span></div><div class="line">    select * from t_dept where deptid = #&#123;deptid&#125;;</div><div class="line"><span class="tag">&lt;/<span class="name">select</span>&gt;</span></div></pre></td></tr></table></figure>

      
    </div>
    
  </div>
  
    
    <div class="copyright">
        <p><span>本文标题:</span><a  href="/2019/08/15/MyBatis多对一和一对多/">MyBatis多对一和一对多</a></p>
        <p><span>文章作者:</span><a  href="/" title="访问 烟花小神博客 的个人博客">烟花小神博客</a></p>
        <p><span>发布时间:</span>2019年08月15日 - 22时07分</p>
        <p><span>最后更新:</span>2019年08月15日 - 22时21分</p>
        <p>
            <span>原始链接:</span><a class="post-url" href="/2019/08/15/MyBatis多对一和一对多/" title="MyBatis多对一和一对多">http://www.lan666.top/2019/08/15/MyBatis多对一和一对多/</a>
            <span class="copy-path" data-clipboard-text="原文: http://www.lan666.top/2019/08/15/MyBatis多对一和一对多/　　作者: 烟花小神博客" title=""></span>
        </p>
        <p>
            <span>许可协议:</span><i class="fa fa-creative-commons"></i> <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/cn/" title="中国大陆 (CC BY-NC-SA 3.0 CN)" target = "_blank">"署名-非商用-相同方式共享 3.0"</a> 转载请保留原文链接及作者。
        </p>
    </div>



<nav id="article-nav">
  
    <a  href="/2019/08/18/SSM整合/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption"><</strong>
      <div class="article-nav-title">
        
          SSM整合
        
      </div>
    </a>
  
  
    <a  href="/2019/08/15/MyBatis动态sql/" id="article-nav-older" class="article-nav-link-wrap">
      <div class="article-nav-title">MyBatis常用的动态sql标签</div>
      <strong class="article-nav-caption">></strong>
    </a>
  
</nav>


  
</article>

    <div id="toc" class="toc-article">
    <strong class="toc-title">文章目录</strong>
    <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#date-2019-8-15-21-23-48"><span class="toc-number">1.</span> <span class="toc-text">date: 2019/8/15 21:23:48  </span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#1-collection-标签"><span class="toc-number"></span> <span class="toc-text">1.collection 标签</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#2-association-标签"><span class="toc-number"></span> <span class="toc-text">2.association 标签</span></a>
</div>
<style>
    .left-col .switch-btn {
        display: none;
    }
    .left-col .switch-area {
        display: none;
    }
</style>
<input type="button" id="tocButton" value="隐藏目录"  title="点击按钮隐藏或者显示文章目录">

<script src="https://7.url.cn/edu/jslib/comb/require-2.1.6,jquery-1.9.1.min.js"></script>

<script>
    var valueHide = "隐藏目录";
    var valueShow = "显示目录";
    if ($(".left-col").is(":hidden")) {
        $("#tocButton").attr("value", valueShow);
    }
    $("#tocButton").click(function() {
        if ($("#toc").is(":hidden")) {
            $("#tocButton").attr("value", valueHide);
            $("#toc").slideDown(320);
            $(".switch-btn, .switch-area").fadeOut(300);
        }
        else {
            $("#tocButton").attr("value", valueShow);
            $("#toc").slideUp(350);
            $(".switch-btn, .switch-area").fadeIn(500);
        }
    })
    if ($(".toc").length < 1) {
        $("#toc, #tocButton").hide();
        $(".switch-btn, .switch-area").show();
    }
</script>




<div class="bdsharebuttonbox">
	<a href="#" class="fx fa-weibo bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
	<a href="#" class="fx fa-weixin bds_weixin" data-cmd="weixin" title="分享到微信"></a>
	<a href="#" class="fx fa-qq bds_sqq" data-cmd="sqq" title="分享到QQ好友"></a>
	<a href="#" class="fx fa-facebook-official bds_fbook" data-cmd="fbook" title="分享到Facebook"></a>
	<a href="#" class="fx fa-twitter bds_twi" data-cmd="twi" title="分享到Twitter"></a>
	<a href="#" class="fx fa-linkedin bds_linkedin" data-cmd="linkedin" title="分享到linkedin"></a>
	<a href="#" class="fx fa-files-o bds_copy" data-cmd="copy" title="分享到复制网址"></a>
</div>
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"2","bdSize":"24"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>




    
        <section class="changyan" id="comments">
  <!--<div id="uyan_frame"></div>-->
  <div id="SOHUCS"></div>
  <script charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/changyan.js"></script>
  <script type="text/javascript">
    window.changyan.api.config({
      appid: 'cyvg6eneY',
      conf: 'prod_722c62cfeceb68b1cdeef0634523c760'
    });
  </script>
</section>
    



    <div class="scroll" id="post-nav-button">
        
            <a  href="/2019/08/18/SSM整合/" title="上一篇: SSM整合">
                <i class="fa fa-angle-left"></i>
            </a>
        
        <a title="文章列表"><i class="fa fa-bars"></i><i class="fa fa-times"></i></a>
        
            <a  href="/2019/08/15/MyBatis动态sql/" title="下一篇: MyBatis常用的动态sql标签">
                <i class="fa fa-angle-right"></i>
            </a>
        
    </div>
    <ul class="post-list"><li class="post-list-item"><a class="post-list-link" href="/2019/08/18/SSM整合/">SSM整合</a></li><li class="post-list-item"><a class="post-list-link" href="/2019/08/15/MyBatis多对一和一对多/">MyBatis多对一和一对多</a></li><li class="post-list-item"><a class="post-list-link" href="/2019/08/15/MyBatis动态sql/">MyBatis常用的动态sql标签</a></li><li class="post-list-item"><a class="post-list-link" href="/2019/08/09/强大的Lombok配置Eclipse/">强大的Lombok配置Eclipse</a></li><li class="post-list-item"><a class="post-list-link" href="/2019/08/09/SpringMVC入门（二）/">SpringMVC入门（二）</a></li><li class="post-list-item"><a class="post-list-link" href="/2019/08/09/SpringMVC入门/">SpringMVC入门</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/05/14/MySQL/">初识MySQL</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/05/10/JSP入门/">JSP入门</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/04/10/Java_api_中文分享/">Java_api_中文分享</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/04/08/JDBC应用实战/">JDBC应用实战</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/04/08/JDBC基础/">JDBC基础知识</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/04/08/运算符和表达式/">运算符和表达式</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/04/08/继承和多态/">继承和多态</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/04/08/抽象类和接口/">抽象类和接口</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/01/18/最大公约数和和最小公倍数/">最大公约数和和最小公倍数</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/01/18/输入任意数排序/">输入任意数排序</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/12/26/银行登录系统/">银行登录系统</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/11/26/Java逻辑运算题/">Java逻辑运算题</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/11/26/int运算法则/">简单的int运算符</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/11/26/String运算法则/">String类型的运算</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/11/26/数据类型/">Java数据类型</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/11/26/java io/">java IO 文件操作</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/10/30/JAVA随机点名/">JAVA点名</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/09/04/进制转换/">进制转换</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/08/20/TTS/">文字转语音</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/08/20/xiaolan/">崭新</a></li></ul>
    
<script src="https://7.url.cn/edu/jslib/comb/require-2.1.6,jquery-1.9.1.min.js"></script>

    <script>
        $(".post-list").addClass("toc-article");
        // $(".post-list-item a").attr("target","_blank");
        $("#post-nav-button > a:nth-child(2)").click(function() {
            $(".fa-bars, .fa-times").toggle();
            $(".post-list").toggle(300);
            if ($(".toc").length > 0) {
                $("#toc, #tocButton").toggle(200, function() {
                    if ($(".switch-area").is(":visible")) {
                        $("#toc, .switch-btn, .switch-area").toggle();
                        $("#tocButton").attr("value", valueHide);
                        }
                    })
            }
            else {
                $(".switch-btn, .switch-area").fadeToggle(300);
            }
        })
    </script>




    <script>
        
    </script>

</div>
      <footer id="footer">
    <div class="outer">
        <div id="footer-info">
            <div class="footer-left">
                &copy; 2021 烟花小神博客
            </div>
			<div class="footer-center">
                备案号：<a href="https://beian.miit.gov.cn" target="_blank">陕ICP备20001529号-1</a>
            </div>
            <!-- <div class="footer-right">
                <a href="http://lan666.top/" target="_blank">2017至今 在访问本网站时 <br>请自觉遵守中华人民共和国法律 并解释一切解释权归烟花小神所有</a> <br> 备案号：陕ICP备20001529号
            </div> -->
        </div>
        
            <div class="visit">
                
                    <span id="busuanzi_container_site_pv" style='display:none'>
                        <span id="site-visit" >极客到访数: 
                            <span id="busuanzi_value_site_uv"></span>
                        </span>
                    </span>
                
                
                   <!-- <span>, </span> -->
                
                
                    <span id="busuanzi_container_page_pv" style='display:none'>
                        <span id="page-visit">本页阅读量: 
                            <span id="busuanzi_value_page_pv"></span>
                        </span>
                    </span>
                
            </div>
        
    </div>
</footer>

    </div>
    
<script src="https://7.url.cn/edu/jslib/comb/require-2.1.6,jquery-1.9.1.min.js"></script>

<script src="/js/main.js"></script>

    <script>
        $(document).ready(function() {
            var backgroundnum = 1;
            var backgroundimg = "url(/background/bg-x.jpg)".replace(/x/gi, Math.ceil(Math.random() * backgroundnum));
            $("#mobile-nav").css({"background-image": backgroundimg,"background-size": "cover","background-position": "center"});
            $(".left-col").css({"background-image": backgroundimg,"background-size": "cover","background-position": "center"});
        })
    </script>


<!-- Google Analytics -->
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'xxxxx', 'auto');
ga('send', 'pageview');

</script>
<!-- End Google Analytics -->



	<script>
	var _hmt = _hmt || [];
	(function() {
	  var hm = document.createElement("script");
	  hm.src = "//hm.baidu.com/hm.js?xxxxxx";
	  var s = document.getElementsByTagName("script")[0]; 
	  s.parentNode.insertBefore(hm, s);
	})();
	</script>



<div class="scroll" id="scroll">
    <a href="#"><i class="fa fa-arrow-up"></i></a>
    <a href="#comments"><i class="fa fa-comments-o"></i></a>
    <a href="#footer"><i class="fa fa-arrow-down"></i></a>
</div>
<script>
    $(document).ready(function() {
        if ($("#comments").length < 1) {
            $("#scroll > a:nth-child(2)").hide();
        };
    })
</script>

<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js">
</script>

  <script language="javascript">
    $(function() {
        $("a[title]").each(function() {
            var a = $(this);
            var title = a.attr('title');
            if (title == undefined || title == "") return;
            a.data('title', title).removeAttr('title').hover(
            function() {
                var offset = a.offset();
                $("<div id=\"anchortitlecontainer\"></div>").appendTo($("body")).html(title).css({
                    top: offset.top - a.outerHeight() - 15,
                    left: offset.left + a.outerWidth()/2 + 1
                }).fadeIn(function() {
                    var pop = $(this);
                    setTimeout(function() {
                        pop.remove();
                    }, pop.text().length * 800);
                });
            }, function() {
                $("#anchortitlecontainer").remove();
            });
        });
    });
</script>


  </div>
</body>
</html>